package org.javaboy.vhr.controller;
import org.javaboy.vhr.model.Recruit;
import org.javaboy.vhr.model.RespBean;
import org.javaboy.vhr.model.RespPageBean;
import org.javaboy.vhr.service.RecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/recruit")
public class RecruitController {
    @Autowired
    RecruitService recruitService;

    @GetMapping("/getrecruit_0")
    public RespPageBean getRecruit_0(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "5") Integer size,Integer status_id){
        return  recruitService.getRecruit_0(page,size,status_id);
    }


    @GetMapping("/getAllRecruit")
    public List<Recruit> getAllRecruit(){
        return recruitService.getAllRecruit();
    }

    @PostMapping("/addRecruit")
    public RespBean addRecruit(@RequestBody Recruit recruit){
        if(recruitService.addRecruit(recruit)==1)
        {
            return  RespBean.ok("新增成功！");
        }
        else {
            return RespBean.error("新增失败！");
        }

    }
}
